package com.JavaNet.chapter04_INetAddress;

import java.net.*;


/**
 * ipv4 or ipv6
 */
public class AddressTests {

    public static int getVersion(InetAddress ia) {
        byte[] address = ia.getAddress();
        if (address.length == 4) {
            System.out.println("INFO  ipv4 ");
            return 4;
        } else if (address.length == 16) {
            System.out.println("INFO  ipv6 ");

            return 6;
        } else return -1;
    }

    public static void main(String[] args) throws UnknownHostException {

        getVersion(InetAddress.getLocalHost());


    }


}
